//
//  SexForDetail.m
//  PetApp
//
//  Created by dllo on 16/3/14.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "SexForDetail.h"

@interface SexForDetail ()

@end

@implementation SexForDetail

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor colorWithRed:0.9462 green:0.9416 blue:0.9508 alpha:1.0];
    [self createSubViews];
}

- (void)createSubViews {
    UIView *viewOfSex = [[UIView alloc] initWithFrame:CGRectMake(0, 30, self.view.frame.size.width, 101)];
    [self.view addSubview:viewOfSex];
    [viewOfSex release];
    
    viewOfSex.backgroundColor = [UIColor whiteColor];
    UILabel *labelOfMan = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 50)];
    [viewOfSex addSubview:labelOfMan];
    [labelOfMan release];
    labelOfMan.text = @"   男";
    labelOfMan.userInteractionEnabled = YES;
    
    UITapGestureRecognizer *tapForMan = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapAction:)];
    [labelOfMan addGestureRecognizer:tapForMan];
    [tapForMan release];
    
    UIView *viewOfGrayLine = [[UIView alloc] initWithFrame:CGRectMake(0, 50, self.view.frame.size.width, 1)];
    [viewOfSex addSubview:viewOfGrayLine];
    [viewOfGrayLine release];
    viewOfGrayLine.backgroundColor = [UIColor colorWithRed:0.8591 green:0.8591 blue:0.8591 alpha:1.0];
    
    UILabel *labelOfWoman = [[UILabel alloc] initWithFrame:CGRectMake(0, 51, self.view.frame.size.width, 50)];
    [viewOfSex addSubview:labelOfWoman];
    [labelOfWoman release];
    labelOfWoman.text = @"   女";
    labelOfWoman.userInteractionEnabled = YES;
    
    UITapGestureRecognizer *tapForWoman = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapAction:)];
    [labelOfWoman addGestureRecognizer:tapForWoman];
    [tapForWoman release];
    
    


}

- (void)handleTapAction:(UITapGestureRecognizer *)tap {
    UILabel *label = (UILabel *)tap.view;
    if ([label.text hasSuffix:@"女"]) {
        self.block(@"女");
        [self.navigationController popViewControllerAnimated:YES];
    }else {
        self.block(@"男");
        [self.navigationController popViewControllerAnimated:YES];
    }
    

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
